<?php

declare(strict_types=1);

namespace App\CustHub\Listener;

use App\CustHub\Event\NewCustomerSchemeTrigger;
use App\CustHub\Service\ChNewCustomerSchemeService;
use Hyperf\Event\Annotation\Listener;
use Hyperf\Event\Contract\ListenerInterface;
use Psr\Container\ContainerInterface;

/**
 * 新客户方案触发监听
 */
#[Listener]
class NewCustomerSchemeListener implements ListenerInterface
{

    protected $container;

    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }

    public function listen(): array
    {
        return [
            NewCustomerSchemeTrigger::class,
        ];
    }

    public function process(object $event): void
    {
        $this->container->get(ChNewCustomerSchemeService::class)->triggerScheme($event->data,$event->robotInfo,$event->isFriendApply);
    }

}